home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_psutils.idb / usr / freeware / bin / fixpsditps.z / fixpsditps
Encoding:
Text File  |  1999-07-16  |  703 b   |  29 lines

  1. #!/usr/freeware/bin/perl
  2. eval 'exec perl -S $0 "$@"'
  3.     if $running_under_some_shell;
  4.  
  5. # fixpsditps: fix psdit output for use in psutils
  6. #
  7. # Copyright (C) Angus J. C. Duggan 1991-1995
  8. # See file LICENSE for details.
  9.  
  10. $nesting = 0;
  11.  
  12. while (<>) {
  13.    if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) {
  14.       print "/p{pop showpage pagesave restore}def\n";
  15.    } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) {
  16.       print $_;
  17.       $nesting++;
  18.    } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
  19.       print $_;
  20.       $nesting--;
  21.    } elsif (/^%%Page:/ && $nesting == 0) {
  22.       print $_;
  23.       print "xi\n";
  24.    } elsif (! /^xi$/) {
  25.       print $_;
  26.    }
  27. }
  28.  
  29.